<template>
  <a-card :bordered="false">
    <a-table
      rowKey="id"
      :columns="columns"
      :dataSource="orderInfo"
      class="j-table-force-nowrap">

      <span slot="action" slot-scope="text, record">
           <router-link :to="{name:'/orderIndex',params: { record }}">事件记录</router-link>
      </span>
    </a-table>
  </a-card>
</template>


<script>
import PageLayout from '@/components/page/PageLayout'
import DetailList from '@/components/tools/DetailList'
import ABadge from "ant-design-vue/es/badge/Badge"
import { getAction } from '@api/manage'
const DetailListItem = DetailList.Item

export default {
  components: {
    PageLayout,
    ABadge,
    DetailList,
    DetailListItem,
  },
  data () {
    return {
      description: 'order管理页面',
      // 表头
      columns: [
        {
          title:'结算ID',
          align:"center",
          dataIndex: 'settlementId'
        },
        {
          title:'结算详情类型',
          align:"center",
          dataIndex: 'type',
          customRender:function (res) {
            var status = "";
            if(res == 1){
              status = "平台";
            }else if(res == 2){
              status = "医生";
            }
            return status;
          }
        },
        {
          title:'结算金额',
          align:"center",
          dataIndex: 'settlementAmount'
        },
        {
          title:'分成比例',
          align:"center",
          dataIndex: 'ratio'
        },
        {
          title:'创建时间',
          align:"center",
          dataIndex: 'createTime',
          customRender:function (text) {
            return !text?"":(text.length>10?text.substr(0,10):text)
          }
        },
      ],
      url: {
        queryOrder: "/settlement/settlementDetail/queryDetail",
      },
      orderInfo:{},
    }
  },
  created() {
    this.getInfo(this.$route.params.id);
  },
  computed: {
    title () {
      return this.$route.meta.title
    }
  },
  methods: {
    //加载订单信息
    getInfo(id){
      let param = {};
      param.settlementId = id;
      getAction(this.url.queryOrder,param).then(res=>{
        this.orderInfo = res.result;
      })
    },
  },

}
</script>

<style scoped>
@import '~@assets/less/common.less';
</style>